Skip to content

fix: improve write_program logic; add tests#579

Merged
MicaiahReid merged 2 commits intomainfrom
fix/write-program-account
Mar 25, 2026
Merged

fix: improve write_program logic; add tests#579
MicaiahReid merged 2 commits intomainfrom
fix/write-program-account

Conversation

@MicaiahReid
Copy link
Collaborator

@MicaiahReid MicaiahReid commented Mar 18, 2026

This PR:

  • fixes write_program fn in locker.rs
    • to summarize, when you call set_account on litesvm, it checks if that account is executable and loads it into a cache of programs. I wasn't aware of this. So when we would 1. write program account, 2. write program data account, the program account wasn't being re-indexed with the new program data. This would cause program updates to fail beyond the initial program written
  • slimmed down the minimum program we deploy
    • when you write am account using set_account, if the account is executable, it's also going to verify that there is an associated program data account, and verify the ELF of the program. So, if a program account is being written without the data account, we're pushing a minimal ELF. I've updated this to be smaller
  • tests for the edge cases that I hit

@MicaiahReid MicaiahReid changed the title Fix/write program account fix: improve write_program logic; add tests Mar 18, 2026
@MicaiahReid MicaiahReid requested a review from lgalabru March 18, 2026 21:24
@MicaiahReid MicaiahReid force-pushed the fix/write-program-account branch from b070599 to 3bd3d11 Compare March 20, 2026 16:01
@MicaiahReid MicaiahReid force-pushed the main branch 5 times, most recently from 5419677 to 2129ad9 Compare March 23, 2026 19:40
Copy link
Collaborator

@lgalabru lgalabru left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks @MicaiahReid !

/// 0x0A0..0x0E0 Section header [0]: SHT_NULL
/// 0x0E0..0x120 Section header [1]: .text
/// 0x120..0x160 Section header [2]: .shstrtab
pub const NOOP_PROGRAM_ELF: &[u8] = &[
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤷‍♂️

@MicaiahReid MicaiahReid merged commit 4d3168f into main Mar 25, 2026
7 of 8 checks passed
@Rmrifa
Copy link

Rmrifa commented Mar 26, 2026

AHBQEXWWVHQAPIYAAAAI7Z5Y5EZVH5VBFDLGC6PWABDS2STYU24AWLWZ5YOQAHLBODIXKFA

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants